package com.lapian.designmode.observer.mashibing.v2;

/**
 * 创建日期：2021/11/15 10:02
 *
 * @author tony.sun
 * 类说明：
 */

public class Mian {
    public static void main(String[] args) {
        Child child = new Child();
        while (!child.isCry()) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("observing");
        }
    }
}
class Child {
    private boolean cry=false;
    public boolean isCry(){
        return cry;
    }
    public void wakeUp(){
        System.out.println("Waked Up! Crying wuwuwuwuw……");
        cry=true;
    }

}
